import TabsView from '@/layouts/tabs/TabsView';
import BlankView from '@/layouts/BlankView';
//  各个的项目路由配置信息
import shopRoutes from './routes/shopRoutes';
import webRoutes from './routes/webRoutes';
import blogRoutes from './routes/blogRoutes';

// 路由配置
const options = {
  routes: [
    {
      path: '/login',
      name: '登录页',
      component: () => import('@/pages/login'),
    },
    {
      path: '/register',
      name: '注册页',
      component: () => import('@/pages/register'),
    },
    {
      path: '*',
      name: '404',
      component: () => import('@/pages/exception/404'),
    },
    {
      path: '/403',
      name: '403',
      component: () => import('@/pages/exception/403'),
    },
    {
      path: '/',
      name: '首页',
      component: TabsView,
      redirect: '/login',
      children: [
        {
          name: 'admin',
          path: '/admin',
          meta: {
            icon: 'user',
            authority: {
              role: 'admin',
            },
          },
          component: () => import('@/pages/admin'),
        },
        {
          path: 'dashboard',
          name: 'Dashboard',
          meta: {
            icon: 'dashboard',
          },
          component: BlankView,
          children: [
            {
              path: 'workplace',
              name: '工作台',
              meta: {
                page: {
                  closable: false,
                },
                icon: 'control',
              },
              component: () => import('@/pages/dashboard/workplace'),
            },
            {
              path: 'analysis',
              name: '电商项目分析页',
              meta: {
                icon: 'line-chart',
              },
              component: () => import('@/pages/dashboard/analysis'),
            },
          ],
        },
        {
          path: 'user',
          name: '个人中心',
          meta: {
            icon: 'user',
          },
          component: BlankView,
          children: [
            {
              path: 'admininfo',
              name: '账户管理',
              meta: {
                icon: 'idcard',
              },
              component: () => import('@/pages/user/admininfo'),
            },
          ],
        },
        // 电商项目页面
        shopRoutes,
        // 官网项目页面
        webRoutes,
        // 博客项目页面
        blogRoutes,
        {
          path: 'feedback',
          name: '反馈',
          meta: {
            icon: 'smile',
          },
          component: BlankView,
          children: [
            {
              path: 'feedback',
              name: '编写',
              meta: {
                icon: 'solution',
              },
              component: () => import('@/pages/feedback/feedback'),
            },
          ],
        },
        {
          path: 'updateLog',
          name: '更新日志',
          meta: {
            icon: 'read',
          },
          component: () => import('@/pages/updateLog/updateLog'),
        },
      ],
    },
  ],
};

export default options;
